import CONFIG from '@/common/config';
import Request from './base';
import i18n from '@/locale';
const request = new Request({
  baseUrl: CONFIG.BASE_URL,
  header: {
    'content-type': 'application/json'
  },
  dealWitchBusiness,
  dealWithHttpError,
  dealWithLocalError
});
// 处理业务异常
function dealWitchBusiness(data, url, showToast) {
  console.log(i18n);
  uni.showToast({ icon: 'error', title: i18n.t('schema.add-success') || '' });
  throw new Error(data);
}

// 处理http的报错
function dealWithHttpError() {}

// 处理本地报错
function dealWithLocalError() {}

export default request;
